<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>水仙花数 | GS0401</title><meta name="author" content="John Doe"><meta name="copyright" content="John Doe"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="水仙花数水仙花数（Narcissistic number）也被称为超完全数字不变数（pluperfect digital invariant, PPDI）、自恋数、自幂数、阿姆斯壮数或阿姆斯特朗数（Armstrong number），水仙花数是指一个 3 位数，它的每个位上的数字的 3次幂之和等于它本身。例如：1^3 + 5^3+ 3^3 &#x3D; 153。 定义水仙花数只是自幂数的一种，严格">
<meta property="og:type" content="article">
<meta property="og:title" content="水仙花数">
<meta property="og:url" content="http://example.com/2022/05/27/ss/%E6%B0%B4%E4%BB%99%E8%8A%B1%E6%95%B0/index.html">
<meta property="og:site_name" content="GS0401">
<meta property="og:description" content="水仙花数水仙花数（Narcissistic number）也被称为超完全数字不变数（pluperfect digital invariant, PPDI）、自恋数、自幂数、阿姆斯壮数或阿姆斯特朗数（Armstrong number），水仙花数是指一个 3 位数，它的每个位上的数字的 3次幂之和等于它本身。例如：1^3 + 5^3+ 3^3 &#x3D; 153。 定义水仙花数只是自幂数的一种，严格">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="">
<meta property="article:published_time" content="2022-05-27T10:21:19.000Z">
<meta property="article:modified_time" content="2022-05-29T03:42:17.457Z">
<meta property="article:author" content="John Doe">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content=""><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="http://example.com/2022/05/27/ss/%E6%B0%B4%E4%BB%99%E8%8A%B1%E6%95%B0/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '水仙花数',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2022-05-29 11:42:17'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.2.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">27</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><hr/></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">GS0401</a></span><div id="menus"><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">水仙花数</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2022-05-27T10:21:19.000Z" title="发表于 2022-05-27 18:21:19">2022-05-27</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2022-05-29T03:42:17.457Z" title="更新于 2022-05-29 11:42:17">2022-05-29</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="水仙花数"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="水仙花数"><a href="#水仙花数" class="headerlink" title="水仙花数"></a>水仙花数</h1><p>水仙花数（Narcissistic number）也被称为超完全数字不变数（pluperfect digital invariant, PPDI）、自恋数、自幂数、阿姆斯壮数或阿姆斯特朗数（Armstrong number），水仙花数是指一个 3 位数，它的每个位上的数字的 3次幂之和等于它本身。例如：1^3 + 5^3+ 3^3 &#x3D; 153。</p>
<h2 id="定义"><a href="#定义" class="headerlink" title="定义"></a>定义</h2><p>水仙花数只是自幂数的一种，严格来说3位数的3次幂数才称为水仙花数。<br>附：其他位数的自幂数名字<br>一位自幂数：独身数<br>三位自幂数：水仙花数<br>四位自幂数：四叶玫瑰数<br>五位自幂数：五角星数<br>六位自幂数：六合数<br>七位自幂数：北斗七星数<br>八位自幂数：八仙数<br>九位自幂数：九九重阳数<br>十位自幂数：十全十美数</p>
<h2 id="常见水仙花数"><a href="#常见水仙花数" class="headerlink" title="常见水仙花数"></a>常见水仙花数</h2><p>水仙花数又称阿姆斯特朗数。<br>三位的水仙花数共有4个：153，370，371，407；<br>四位的四叶玫瑰数共有3个：1634，8208，9474；<br>五位的五角星数共有3个：54748，92727，93084；<br>六位的六合数只有1个：548834；<br>七位的北斗七星数共有4个：1741725，4210818，9800817，9926315；<br>八位的八仙数共有3个：24678050，24678051，88593477；<br>九位的九九重阳数共有4个： 146511208，472335975，534494836，912985153；<br>十位的自幂数只有1个：4679307774<br>使用高精度计算，可以得到超过int类型上限的水仙花数：<br>5: 93084<br>5: 92727<br>5: 54748<br>6: 548834<br>7: 9800817<br>7: 4210818<br>7: 1741725<br>7: 9926315<br>8: 24678050<br>8: 24678051<br>8: 88593477<br>9: 146511208<br>9: 472335975<br>9: 534494836<br>9: 912985153<br>10: 4679307774<br>11: 32164049650<br>11: 40028394225<br>11: 42678290603<br>11: 49388550606<br>11: 32164049651<br>11: 94204591914<br>11: 44708635679<br>11: 82693916578<br>14: 28116440335967<br>16: 4338281769391370<br>16: 4338281769391371<br>17: 21897142587612075<br>17: 35641594208964132<br>17: 35875699062250035<br>19: 1517841543307505039<br>19: 3289582984443187032<br>19: 4929273885928088826<br>19: 4498128791164624869<br>20: 63105425988599693916<br>21: 449177399146038697307<br>21: 128468643043731391252<br>23: 27907865009977052567814<br>23: 35452590104031691935943<br>23: 27879694893054074471405<br>23: 21887696841122916288858<br>24: 174088005938065293023722<br>24: 188451485447897896036875<br>(为环保起见，24位以上的水仙花数略)<br>最大的水仙花数有39位。十进制自然数中的所有水仙花数共有88个。</p>
<h2 id="求取方法"><a href="#求取方法" class="headerlink" title="求取方法"></a>求取方法</h2><p>以下为在各种编程语言中实现求取水仙花数的方法（非高精度）。</p>
<h3 id="C-实现"><a href="#C-实现" class="headerlink" title="C 实现"></a>C 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">//方法一</span><br><span class="line"><span class="comment">#include&lt;stdio.h&gt;</span></span><br><span class="line"><span class="comment">#include&lt;stdlib.h&gt;</span></span><br><span class="line"><span class="comment">#include&lt;stdbool.h&gt;</span></span><br><span class="line">int cube(const int n)&#123;</span><br><span class="line">    <span class="built_in">return</span> n*n*n;</span><br><span class="line">&#125;</span><br><span class="line">bool</span><br><span class="line">isNarcissistic(const int n)&#123;//判断是不是水仙花数</span><br><span class="line">    int hundreds=n/100;</span><br><span class="line">    int tens=n/10-hundreds*10;</span><br><span class="line">    int ones=n%10;</span><br><span class="line">    <span class="built_in">return</span> cube(hundreds)+cube(tens)+cube(ones)==n;</span><br><span class="line">&#125;</span><br><span class="line">int main(void)&#123;</span><br><span class="line">    int i;</span><br><span class="line">    <span class="keyword">for</span>(i=100;i&lt;1000;++i)&#123;</span><br><span class="line">        <span class="keyword">if</span>(isNarcissistic(i))</span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">&quot;%d\n&quot;</span>,i);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="built_in">return</span> 0;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>


<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">//方法二</span><br><span class="line"><span class="comment">#include &lt;stdio.h&gt; </span></span><br><span class="line"><span class="comment">#include &lt;stdlib.h&gt;</span></span><br><span class="line">int <span class="function"><span class="title">main</span></span>() </span><br><span class="line">&#123; </span><br><span class="line">    int i,j,k,n; </span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;&#x27;water flower&#x27;number is:&quot;</span>); </span><br><span class="line">    <span class="keyword">for</span>(n=100;n&lt;1000;n++) </span><br><span class="line">    &#123; </span><br><span class="line">        i=n/100;/*分解出百位*/ </span><br><span class="line">        j=n/10%10;/*分解出十位*/ </span><br><span class="line">        k=n%10;/*分解出个位*/ </span><br><span class="line">        <span class="keyword">if</span>(n==i*i*i+j*j*j+k*k*k) </span><br><span class="line">        &#123; </span><br><span class="line">            <span class="built_in">printf</span>(<span class="string">&quot;%-5d&quot;</span>,n); </span><br><span class="line">        &#125; </span><br><span class="line">    &#125; </span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">&quot;\n&quot;</span>);</span><br><span class="line">    <span class="built_in">return</span> 0;</span><br><span class="line">&#125; </span><br></pre></td></tr></table></figure>


<h3 id="C-实现-1"><a href="#C-实现-1" class="headerlink" title="C++ 实现"></a>C++ 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">//一：C++中水仙花数实现代码</span><br><span class="line"><span class="comment">#include&lt;iostream&gt;</span></span><br><span class="line">using std::cout;</span><br><span class="line">using std::endl;</span><br><span class="line"><span class="comment">#define f(a) (a)*(a)*(a)</span></span><br><span class="line">int <span class="function"><span class="title">main</span></span>() &#123;</span><br><span class="line">    <span class="keyword">for</span> (int i = 100;i &lt; 1000;i++)</span><br><span class="line">        <span class="keyword">if</span> (f(i % 10) + f(i / 10 % 10) + f(i / 100 % 10) == i)</span><br><span class="line">            cout &lt;&lt; <span class="string">i &lt;&lt; endl;</span></span><br><span class="line"><span class="string">    system(&quot;pause&quot;);</span></span><br><span class="line"><span class="string">    return 0;</span></span><br><span class="line"><span class="string">&#125;</span></span><br></pre></td></tr></table></figure>


<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line">//二：C++中任意位数水仙花数实现代码</span><br><span class="line"><span class="comment">#include&lt;iostream&gt;</span></span><br><span class="line"><span class="comment">#include&lt;Cath&gt;</span></span><br><span class="line">using namespace std;</span><br><span class="line">int main(])</span><br><span class="line">&#123;</span><br><span class="line">    long n1, n2, a;</span><br><span class="line">    int i;</span><br><span class="line">    cout &lt;&lt; <span class="string">&quot;请输入Narcissistic number的位数:&quot;</span> &lt;&lt; <span class="string">endl;</span></span><br><span class="line"><span class="string">    cin &gt;&gt; i;</span></span><br><span class="line"><span class="string">    cout &lt;&lt; i &lt;&lt; &quot;位数的Narcissistic number包括:&quot; &lt;&lt; endl</span>;</span><br><span class="line">    <span class="keyword">for</span> (n1 = pow(10, i - 1); n1 &lt; pow(10, i); n1++)</span><br><span class="line">    &#123;</span><br><span class="line">        n2 = 0;</span><br><span class="line">        <span class="keyword">for</span> (int j=0; j &lt; i; j++)</span><br><span class="line">        &#123;</span><br><span class="line">            a = pow(10, j);</span><br><span class="line">            a = n1 / a;</span><br><span class="line">            a = a % 10;</span><br><span class="line">            a = pow(a, i);</span><br><span class="line">            n2 = n2 + a;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">if</span> (n1 == n2)</span><br><span class="line">            cout &lt;&lt; <span class="string">n1 &lt;&lt; endl;</span></span><br><span class="line"><span class="string">    &#125;</span></span><br><span class="line"><span class="string">    return 0;</span></span><br><span class="line"><span class="string">&#125;</span></span><br></pre></td></tr></table></figure>


<h3 id="Java-实现"><a href="#Java-实现" class="headerlink" title="Java 实现"></a>Java 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">//方法一</span><br><span class="line">package sy1;</span><br><span class="line">public class TestNarcissus &#123;</span><br><span class="line">     public static void main(String[] args) &#123; </span><br><span class="line">            int num = 100; int a[] = new int[3];</span><br><span class="line">            System.out.print(<span class="string">&quot;3位的水仙花数有：\t&quot;</span>); </span><br><span class="line">            <span class="keyword">while</span> (num &lt;= 999) &#123; </span><br><span class="line">             int <span class="built_in">sum</span> =0; </span><br><span class="line">             a[0] = num / 100 % 10;</span><br><span class="line">             a[1] = num / 10 % 10; </span><br><span class="line">             a[2] = num % 10;</span><br><span class="line">              <span class="keyword">for</span> (int i = 0; i &lt; 3; i++) &#123;</span><br><span class="line">                  <span class="built_in">sum</span> = <span class="built_in">sum</span> + (int) Math.pow(a[i], 3); </span><br><span class="line">              &#125; </span><br><span class="line">              <span class="keyword">if</span> (num ==<span class="built_in">sum</span>) &#123; </span><br><span class="line">                  System.out.print(num + <span class="string">&quot;\t&quot;</span>); </span><br><span class="line">                           &#125; </span><br><span class="line">                           num++; </span><br><span class="line">      &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>


<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line">//方法二</span><br><span class="line">package sy1;</span><br><span class="line">import java.util.Scanner;</span><br><span class="line">public class TestNarcissus2 &#123;</span><br><span class="line">    public static void main(String[] agrs) &#123;    </span><br><span class="line">            System.out.print(<span class="string">&quot;指定最大位数N:&quot;</span>);</span><br><span class="line">            Scanner input = new Scanner(System.<span class="keyword">in</span>);</span><br><span class="line">            int N = input.nextInt();</span><br><span class="line">            input.close();</span><br><span class="line">            <span class="keyword">for</span> (int i = 3; i &lt;= N; i++) &#123;</span><br><span class="line">                int a[] = new int[i];</span><br><span class="line">                int num = (int) Math.pow(10, i - 1) + 1;</span><br><span class="line">                System.out.print(i + <span class="string">&quot;位的水仙花数有：\t&quot;</span>);</span><br><span class="line">                <span class="keyword">while</span> (num &lt;= Math.pow(10, i)) &#123;</span><br><span class="line">                    int <span class="built_in">sum</span> = 0;</span><br><span class="line">                    <span class="keyword">for</span> (int j = 0; j &lt; i; j++)</span><br><span class="line">                        a[j] = (int) (num / Math.pow(10, j) % 10);</span><br><span class="line">                    <span class="keyword">for</span> (int j = 0; j &lt; i; j++) </span><br><span class="line">                        <span class="built_in">sum</span> = <span class="built_in">sum</span> + (int) Math.pow(a[j], i);</span><br><span class="line">                    <span class="keyword">if</span> (num == <span class="built_in">sum</span>)</span><br><span class="line">                        System.out.print(num + <span class="string">&quot;\t&quot;</span>);</span><br><span class="line">                    num++;</span><br><span class="line">                &#125;</span><br><span class="line">                System.out.print(<span class="string">&quot;\n&quot;</span>);</span><br><span class="line">            &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>


<h3 id="Python-实现"><a href="#Python-实现" class="headerlink" title="Python 实现"></a>Python 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#方法一：</span></span><br><span class="line">def narcissistic_number_1(num):</span><br><span class="line">    length = len(str(num))</span><br><span class="line">    count = length</span><br><span class="line">    num_sum = 0</span><br><span class="line">    <span class="keyword">while</span> count:</span><br><span class="line">        num_sum += ((num // 10 ** (count - 1)) % 10) ** length</span><br><span class="line">        count -= 1</span><br><span class="line">    <span class="keyword">if</span> num_sum == num:</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;%d is %d bit narcissistic_number&quot;</span> % (num, length))</span><br><span class="line"> </span><br><span class="line"><span class="comment">#方法二：</span></span><br><span class="line">def narcissistic_number_2(num):</span><br><span class="line">    s = str(num)</span><br><span class="line">    length = len(s)</span><br><span class="line">    sum_num = 0</span><br><span class="line">    <span class="keyword">for</span> i <span class="keyword">in</span> s:</span><br><span class="line">        sum_num += int(i)**length</span><br><span class="line">    <span class="keyword">if</span> sum_num == num:</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;%d is a %d bit narcissistic_number&quot;</span> % (num, length))</span><br><span class="line"> </span><br><span class="line">max_num = int(input(<span class="string">&#x27;请输入最大范围&#x27;</span>))</span><br><span class="line"><span class="comment"># 获取小于指定数的阿姆斯特朗数</span></span><br><span class="line"><span class="keyword">for</span> num <span class="keyword">in</span> range(0, max_num):</span><br><span class="line">    narcissistic_number_1(num)        <span class="comment">#调用方法一,方法二均可</span></span><br><span class="line"><span class="comment">#方法三</span></span><br><span class="line"><span class="keyword">for</span> i <span class="keyword">in</span> range(1,10):</span><br><span class="line">    <span class="keyword">for</span> j <span class="keyword">in</span> range(0,10):</span><br><span class="line">        <span class="keyword">for</span> k <span class="keyword">in</span> range(0,10):</span><br><span class="line">           <span class="keyword">if</span> i*100+j*10+k==i**3+j**3+k**3:</span><br><span class="line">                <span class="built_in">print</span>(i*100+j*10+k)</span><br><span class="line"><span class="comment">#四位自幂数：</span></span><br><span class="line"><span class="keyword">for</span> i <span class="keyword">in</span> range(1000, 10000):</span><br><span class="line">    a = int(i/1000)</span><br><span class="line">    b = int(i % 1000/100)</span><br><span class="line">    c = int(i % 100/10)</span><br><span class="line">    d = int(i % 10)</span><br><span class="line">    <span class="keyword">if</span> pow(a, 4) + pow(b, 4) + pow(c, 4) + pow(d, 4) == i:</span><br><span class="line">        <span class="built_in">print</span>(i)</span><br><span class="line">        </span><br></pre></td></tr></table></figure>

<h3 id="JavaScript-实现"><a href="#JavaScript-实现" class="headerlink" title="JavaScript 实现"></a>JavaScript 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;!--包含在HTML中--&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">    &lt;<span class="built_in">head</span>&gt;</span><br><span class="line">        &lt;meta charset=<span class="string">&quot;utf-8&quot;</span>&gt;</span><br><span class="line">    &lt;/head&gt;</span><br><span class="line">    &lt;body&gt;</span><br><span class="line">    &lt;script <span class="built_in">type</span>=<span class="string">&quot;text/javascript&quot;</span>&gt;</span><br><span class="line">        var a = 0, b = 0, c = 0;</span><br><span class="line">        <span class="keyword">for</span> (var i = 100; i &lt; 1000; i++)</span><br><span class="line">        &#123;</span><br><span class="line">        a = i % 10;</span><br><span class="line">        b = parseInt(((i / 10) % 10));</span><br><span class="line">        c = parseInt(i / 100);</span><br><span class="line">        <span class="keyword">if</span> (i === a * a * a + b * b * b + c * c * c)</span><br><span class="line">        &#123;</span><br><span class="line">          document.write(<span class="string">&#x27;水仙花数： &#x27;</span> + i + <span class="string">&#x27;&lt;br/&gt;&#x27;</span>);</span><br><span class="line">        &#125;</span><br><span class="line">      &#125;</span><br><span class="line">    &lt;/script&gt;</span><br><span class="line">    &lt;/body&gt;</span><br><span class="line">&lt;/html&gt;</span><br></pre></td></tr></table></figure>


<h3 id="PHP-实现"><a href="#PHP-实现" class="headerlink" title="PHP 实现"></a>PHP 实现</h3><h4 id="PHP水仙花数实现代码"><a href="#PHP水仙花数实现代码" class="headerlink" title="PHP水仙花数实现代码"></a>PHP水仙花数实现代码</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">&lt;?php</span><br><span class="line">//使用系统自带函数，即可实现幂运算，何必画蛇添足，自己写函数</span><br><span class="line">functionis_narcissistic(<span class="variable">$n</span>)</span><br><span class="line">&#123;</span><br><span class="line"><span class="variable">$hundreds</span>=floor(<span class="variable">$n</span>/100);//分解出百位</span><br><span class="line"><span class="variable">$tens</span>=floor(<span class="variable">$n</span>/10)%10;//分解出十位</span><br><span class="line"><span class="variable">$ones</span>=floor(<span class="variable">$n</span>%10);//分解出个位</span><br><span class="line"><span class="built_in">return</span>(bool)(pow(<span class="variable">$hundreds</span>,3)+pow(<span class="variable">$tens</span>,3)+pow(<span class="variable">$ones</span>,3)==<span class="variable">$n</span>);</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">for</span>(<span class="variable">$i</span>=100;<span class="variable">$i</span>&lt;1000;++<span class="variable">$i</span>)</span><br><span class="line">&#123;</span><br><span class="line"><span class="keyword">if</span>(is_narcissistic(<span class="variable">$i</span>))</span><br><span class="line"><span class="built_in">echo</span><span class="variable">$i</span>.<span class="string">&quot;\n&quot;</span>;</span><br><span class="line">&#125;</span><br><span class="line">die();</span><br><span class="line">?&gt;</span><br></pre></td></tr></table></figure>


<h4 id="PHP所有位数理论输出"><a href="#PHP所有位数理论输出" class="headerlink" title="PHP所有位数理论输出"></a>PHP所有位数理论输出</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line">&lt;?php</span><br><span class="line">/**</span><br><span class="line">*水仙花数为不小于3位的数字,每位数字的N次幂的和等于该数字.N为该数字的位数</span><br><span class="line">*@namedaffodilsNum水仙花数</span><br><span class="line">*@param<span class="variable">$places</span>水仙花位数&gt;=3</span><br><span class="line">*/</span><br><span class="line">functiondaffodilsNum(<span class="variable">$places</span>=3)&#123;//定义位数</span><br><span class="line"><span class="keyword">if</span>(!defined(<span class="string">&#x27;PLACES&#x27;</span>))define(<span class="string">&#x27;PLACES&#x27;</span>,is_numeric(<span class="variable">$places</span>)?<span class="variable">$places</span>:3);</span><br><span class="line"><span class="keyword">if</span>(PLACES&gt;=3)&#123;<span class="variable">$min</span>=pow(10,PLACES-1);</span><br><span class="line">//选数范围起始位置</span><br><span class="line"><span class="variable">$max</span>=pow(10,PLACES);</span><br><span class="line">//选数范围结束位置//开始选数</span><br><span class="line"><span class="keyword">for</span>(<span class="variable">$i</span>=<span class="variable">$min</span>,<span class="variable">$out</span>=<span class="string">&#x27;&#x27;</span>;<span class="variable">$i</span>&lt;<span class="variable">$max</span>;<span class="variable">$i</span>++)&#123;<span class="variable">$sum</span>=0;</span><br><span class="line">//当前选数下各个幂值的和</span><br><span class="line"><span class="variable">$arr</span>=str_split(<span class="variable">$i</span>);//以字符串方式分割选数</span><br><span class="line"><span class="keyword">for</span>(<span class="variable">$j</span>=0;<span class="variable">$j</span>&lt;PLACES;++<span class="variable">$j</span>)//对每个数字作幂操作并累加</span><br><span class="line">&#123;<span class="variable">$sum</span>+=pow(<span class="variable">$arr</span>[<span class="variable">$j</span>],PLACES);<span class="keyword">if</span>(<span class="variable">$sum</span>&gt;<span class="variable">$i</span>)</span><br><span class="line">//如果当前累加已大于选数,则跳出循环</span><br><span class="line"><span class="built_in">break</span>;&#125;<span class="keyword">if</span>(<span class="variable">$sum</span>==<span class="variable">$i</span>)//如果符合定义,将该数字添加到输出队列</span><br><span class="line"><span class="variable">$out</span>.=<span class="variable">$i</span>.<span class="string">&quot;\n&quot;</span>;&#125;</span><br><span class="line">//输出队列</span><br><span class="line"><span class="built_in">echo</span><span class="variable">$out</span>;&#125;</span><br><span class="line">&#125;</span><br><span class="line">echodaffodilsNum(3);</span><br><span class="line"> </span><br><span class="line">?&gt;</span><br></pre></td></tr></table></figure>

<h3 id="MATLAB-实现"><a href="#MATLAB-实现" class="headerlink" title="MATLAB 实现"></a>MATLAB 实现</h3><h4 id="方法一："><a href="#方法一：" class="headerlink" title="方法一："></a>方法一：</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">for</span> m=100:999</span><br><span class="line">m1=fix(m/100);</span><br><span class="line">m2=rem(fix(m/10),10);</span><br><span class="line">m3=rem(m,10);</span><br><span class="line"><span class="keyword">if</span> m==m1^3+m2^3+m3^3</span><br><span class="line">disp(m)</span><br><span class="line">end</span><br><span class="line">end</span><br></pre></td></tr></table></figure>

<h4 id="方法二："><a href="#方法二：" class="headerlink" title="方法二："></a>方法二：</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">m = 100:999;</span><br><span class="line">n = floor(m/100).^3+mod(fix(m/10),10).^3+mod(m,10).^3;</span><br><span class="line">m(find(m==n))</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h3 id="swift-实现"><a href="#swift-实现" class="headerlink" title="swift 实现"></a>swift 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">var i = 100</span><br><span class="line"><span class="keyword">while</span> i &lt; 999 &#123;</span><br><span class="line">    <span class="built_in">let</span> nums = i.description.map(&#123;Double(<span class="variable">$0</span>.description)!&#125;)</span><br><span class="line">    <span class="keyword">if</span> nums.map(&#123;pow(<span class="variable">$0</span>,Double(nums.count))&#125;).reduce(0,+) == Double(i) &#123;</span><br><span class="line">        <span class="built_in">print</span>(<span class="string">&quot;水仙花：\(i)&quot;</span>)</span><br><span class="line">    &#125;</span><br><span class="line">    i += 1</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="Golang-实现"><a href="#Golang-实现" class="headerlink" title="Golang 实现"></a>Golang 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><span class="line">package main</span><br><span class="line">import (</span><br><span class="line">    <span class="string">&quot;fmt&quot;</span></span><br><span class="line">    <span class="string">&quot;strconv&quot;</span></span><br><span class="line">)</span><br><span class="line">func <span class="function"><span class="title">main</span></span>() &#123;</span><br><span class="line">    var a, b int64</span><br><span class="line">    fmt.Println(<span class="string">&quot;请输入求a,b：&quot;</span>)</span><br><span class="line">    fmt.Scanf(<span class="string">&quot;%d,%d&quot;</span>, &amp;a, &amp;b)</span><br><span class="line">    <span class="keyword">if</span> a &gt; b &#123;</span><br><span class="line">        a, b = b, a</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">for</span> i := a; i &lt;= b; i++ &#123;</span><br><span class="line">        <span class="keyword">if</span> isNarcissusFew(i) &#123;</span><br><span class="line">            fmt.Println(i)</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line">func isNarcissusFew(number int64) bool &#123;</span><br><span class="line">    var <span class="built_in">sum</span> int64</span><br><span class="line">    numberStr := strconv.FormatInt(number, 10)</span><br><span class="line">    <span class="keyword">for</span> _, data := range numberStr &#123;</span><br><span class="line">        lenght := len(numberStr)</span><br><span class="line">        num := (int64)(data - 48)</span><br><span class="line">        var sum1 int64 = 1</span><br><span class="line">        <span class="keyword">for</span> lenght != 0 &#123;</span><br><span class="line">            sum1 *= num</span><br><span class="line">            lenght--</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="built_in">sum</span> += sum1</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">if</span> <span class="built_in">sum</span> == number &#123;</span><br><span class="line">        <span class="built_in">return</span> <span class="literal">true</span></span><br><span class="line">    &#125;</span><br><span class="line">    <span class="built_in">return</span> <span class="literal">false</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="C-实现-2"><a href="#C-实现-2" class="headerlink" title="C# 实现"></a>C# 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">for</span>(int i=100;i&lt;1000;i++)</span><br><span class="line">&#123;</span><br><span class="line">    int bai=0;int shi=0;int ge=0;int baiyushu=0;</span><br><span class="line">    bai=i/100;</span><br><span class="line">    baiyushu=i%100;</span><br><span class="line">    shi=baiyushu/10;</span><br><span class="line">    ge=baiyushu%10;</span><br><span class="line">    <span class="keyword">if</span>(i==bai*bai*bai+shi*shi*shi+ge*ge*ge)</span><br><span class="line">    &#123;</span><br><span class="line">        Console.WriteLine(<span class="string">&quot;水仙花数：&quot;</span>+i+<span class="string">&quot;&lt;br&gt;&quot;</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">//补充C<span class="comment">#水仙花数实现代码(任意位数)</span></span><br><span class="line">/// &lt;summary&gt;/// 判断一个数是否是水仙花数/// &lt;/summary&gt;///</span><br><span class="line"> &lt;param name=<span class="string">&quot;num&quot;</span>&gt;要判断的数&lt;/param&gt;/// </span><br><span class="line"> &lt;returns&gt;判断结果:<span class="literal">true</span>-是,<span class="literal">false</span>-否&lt;/returns&gt;</span><br><span class="line">bool isWaterFlower(int num)&#123;<span class="keyword">if</span> (num &lt;= 0)&#123;<span class="built_in">return</span> <span class="literal">false</span>;&#125;</span><br><span class="line">int temp = num;</span><br><span class="line">//将要判断的数值各位上的数字拆开放在集合中</span><br><span class="line">ArrayList list = new ArrayList();</span><br><span class="line"> <span class="keyword">while</span> (temp &gt; 0)</span><br><span class="line">    &#123;</span><br><span class="line">    list.Add(temp % 10);temp /= 10;&#125;</span><br><span class="line">//判断各位上的数字位数次方之后是否等于要判断是数，是的话则为水仙花数</span><br><span class="line">    int <span class="built_in">sum</span> = 0;</span><br><span class="line">    foreach (int i <span class="keyword">in</span> list)</span><br><span class="line">    &#123;</span><br><span class="line">        int mul = 1;</span><br><span class="line">        <span class="keyword">for</span> (int j = 0; j &lt; list.Count; j++)&#123;mul *= i;&#125;</span><br><span class="line">        <span class="built_in">sum</span> += mul;</span><br><span class="line">      &#125;</span><br><span class="line">      <span class="built_in">return</span> <span class="built_in">sum</span> == num;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">补充C<span class="comment">#中1000以内水仙花数实现代码（同理可根据需求自行增加变量及循环次数，此处仅为举例）</span></span><br><span class="line">int number = 100;  //声明变量number初始值为100</span><br><span class="line"><span class="keyword">for</span>(int i=1;i&lt;10;i++)  //声明百位数的值变量为 i，赋值为1,每次循环加1</span><br><span class="line">&#123;</span><br><span class="line">  <span class="keyword">for</span>(int j=0;j&lt;10;j++)  //声明十位数的值变量为j，赋值为0，每次循环加1</span><br><span class="line">  &#123;</span><br><span class="line">    <span class="keyword">for</span>(int r=0;r&lt;10;r++)  //声明个位数的值为r，赋值为0，每次循环加1</span><br><span class="line">    &#123;</span><br><span class="line">      <span class="keyword">if</span>(i*i*i+j*j*j+r*r*r==number) </span><br><span class="line">      &#123;</span><br><span class="line">        Console.WriteLine(<span class="string">&quot;水仙花数：&#123;0&#125;&quot;</span>, number);</span><br><span class="line">      &#125;</span><br><span class="line">      number++; //number加1</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>


<h3 id="ALGOL-实现"><a href="#ALGOL-实现" class="headerlink" title="ALGOL 实现"></a>ALGOL 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">begin</span><br><span class="line">    <span class="built_in">integer</span> i,j,k;</span><br><span class="line">    <span class="keyword">for</span> i := 1 step 1 until 9 <span class="keyword">do</span></span><br><span class="line">        <span class="keyword">for</span> j := 0 step 1 until 9 <span class="keyword">do</span></span><br><span class="line">            <span class="keyword">for</span> k := 0 step 1 until 9 <span class="keyword">do</span></span><br><span class="line">                <span class="keyword">if</span> i×i×i + j×j×j + k×k×k = 100×i + 10×j + k <span class="keyword">then</span></span><br><span class="line">                    <span class="built_in">print</span> (100×i + 10×j + k);</span><br><span class="line">end</span><br></pre></td></tr></table></figure>


<h3 id="pascal-实现"><a href="#pascal-实现" class="headerlink" title="pascal 实现"></a>pascal 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><span class="line">program narcissistic_number;</span><br><span class="line">var a,b,c:<span class="built_in">integer</span>;</span><br><span class="line">begin</span><br><span class="line">　<span class="keyword">for</span> a:=1 to 9 <span class="keyword">do</span>　</span><br><span class="line">        <span class="keyword">for</span> b:=0 to 9 <span class="keyword">do</span></span><br><span class="line">    　    <span class="keyword">for</span> c:=0 to 9 <span class="keyword">do</span></span><br><span class="line">            　<span class="keyword">if</span> a*a*a+b*b*b+c*c*c=100*a+10*b+c <span class="keyword">then</span></span><br><span class="line">                　writeln(100*a+10*b+c);</span><br><span class="line">end.</span><br><span class="line">或</span><br><span class="line">program narcissistic_number;</span><br><span class="line">var a,b,c,d:<span class="built_in">integer</span>;</span><br><span class="line">begin</span><br><span class="line">　<span class="keyword">for</span> a:=100 to 999 <span class="keyword">do</span></span><br><span class="line">　begin </span><br><span class="line">        b:=a mod 10; </span><br><span class="line">        c:=a mod 100 div 10;</span><br><span class="line">        d:=a div 100;</span><br><span class="line">    　<span class="keyword">if</span> b*b*b+c*c*c+d*d*d=a <span class="keyword">then</span></span><br><span class="line">            writeln(a);</span><br><span class="line">　end;</span><br><span class="line">end.</span><br><span class="line">或</span><br><span class="line">program narcissistic_number;</span><br><span class="line">var a, b, c, i, t : <span class="built_in">integer</span>;</span><br><span class="line">begin</span><br><span class="line">    i := 100; </span><br><span class="line">    repeat</span><br><span class="line">        a:=trunc(i/100);</span><br><span class="line">        b:=trunc(i/10) - a*10;</span><br><span class="line">        c:=i-trunc(i/10) * 10;</span><br><span class="line">        t:= a*a*a + b*b*b + c*c*c;</span><br><span class="line">        <span class="keyword">if</span> i = t <span class="keyword">then</span></span><br><span class="line">            writeln(i,<span class="string">&#x27;=&#x27;</span>,a,<span class="string">&#x27;^3+&#x27;</span>,b,<span class="string">&#x27;^3+&#x27;</span>,c,<span class="string">&#x27;^3&#x27;</span>);</span><br><span class="line">    i := i + 1 until i &gt; 999</span><br><span class="line">end.</span><br></pre></td></tr></table></figure>


<h3 id="BASIC-实现"><a href="#BASIC-实现" class="headerlink" title="BASIC 实现"></a>BASIC 实现</h3><p>1-999999之间</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">REM Print all the Narcissistic number</span><br><span class="line">REM between 1 and 999999</span><br><span class="line">FOR i = 1 TO 999999</span><br><span class="line"> e$ = STR$(i)</span><br><span class="line"> a$ = MID(e$, 1, 1)</span><br><span class="line"> b$ = MID(e$, 2, 1)</span><br><span class="line"> c$ = MID(e$, 3, 1)</span><br><span class="line"> d$ = MID(e$, 4, 1)</span><br><span class="line"> a = VAL(a$) AND b = VAL(b$) AND c = VAL(c$) AND d = VAL(d$)</span><br><span class="line"> IF i = a ^ 4 + b ^ 4 + c ^ 4 + d ^ 4 THEN PRINT i;</span><br><span class="line">NEXT i</span><br><span class="line">ENDPB</span><br></pre></td></tr></table></figure>


<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"> 实现的方法（只计3位数）</span><br><span class="line">int s,a,b,c</span><br><span class="line"><span class="keyword">for</span> s=100 to 999</span><br><span class="line">a=<span class="built_in">integer</span>(s/100)</span><br><span class="line">b=<span class="built_in">integer</span>((s - a*100)/10)</span><br><span class="line">c=s - <span class="built_in">integer</span>(s/10)*10</span><br><span class="line"><span class="keyword">if</span> s=a^3+b^3+c^3 <span class="keyword">then</span></span><br><span class="line">    messagebox(<span class="string">&quot;&quot;</span>,s)</span><br><span class="line">end <span class="keyword">if</span></span><br><span class="line">next</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h3 id="Visual-Basic-实现"><a href="#Visual-Basic-实现" class="headerlink" title="Visual Basic 实现"></a>Visual Basic 实现</h3><h4 id="Visual-Basic-的“水仙花数”实现代码"><a href="#Visual-Basic-的“水仙花数”实现代码" class="headerlink" title="Visual Basic 的“水仙花数”实现代码"></a>Visual Basic 的“水仙花数”实现代码</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">Private Sub Command1_Click()</span><br><span class="line">Dim i As Integer, a As Integer, b As Integer, c As Integer</span><br><span class="line">For i = 100 To 999 Step 1</span><br><span class="line">    a = i \ 100</span><br><span class="line">    b = (i - 100 * a) \ 10</span><br><span class="line">    c = i - 100 * a - 10 * b</span><br><span class="line">    If a^(3) + b^(3) + c^(3) = i Then</span><br><span class="line">        Print i</span><br><span class="line">    End If</span><br><span class="line">    Next i</span><br><span class="line">End Sub</span><br></pre></td></tr></table></figure>


<h4 id="Visual-Basic-简单易懂代码实现"><a href="#Visual-Basic-简单易懂代码实现" class="headerlink" title="Visual Basic 简单易懂代码实现"></a>Visual Basic 简单易懂代码实现</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">Dim a As Integer, b As Integer, c As Integer</span><br><span class="line">    For a = 0 To 9</span><br><span class="line">        For b = 0 To 9</span><br><span class="line">            For c = 0 To 9</span><br><span class="line">                If a * 100 + b * 10 + c = a ^ 3 + b ^ 3 + c ^ 3 Then</span><br><span class="line">                    Console.WriteLine(a * 100 + b * 10 + c)</span><br><span class="line">                End If</span><br><span class="line">            Next</span><br><span class="line">        Next</span><br><span class="line">    Next</span><br></pre></td></tr></table></figure>


<h3 id="asp-中VB实现"><a href="#asp-中VB实现" class="headerlink" title="asp 中VB实现"></a>asp 中VB实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">&lt;%</span><br><span class="line">dim a,b,c,d,m,n,z</span><br><span class="line">i=1</span><br><span class="line"><span class="keyword">for</span> i=100 to 999</span><br><span class="line">a=mid(i,1,1)</span><br><span class="line">b=mid(i,2,1)</span><br><span class="line">c=mid(i,3,1)</span><br><span class="line">d=a*a*a</span><br><span class="line">m=b*b*b</span><br><span class="line">n=c*c*c</span><br><span class="line">z=d+m+n</span><br><span class="line"><span class="keyword">if</span> z=i <span class="keyword">then</span></span><br><span class="line">    response.write z &amp; <span class="string">&quot;&lt;br&gt;&quot;</span></span><br><span class="line">end <span class="keyword">if</span></span><br><span class="line">next</span><br><span class="line">%&gt;</span><br></pre></td></tr></table></figure>


<h3 id="FORTRAN-实现"><a href="#FORTRAN-实现" class="headerlink" title="FORTRAN 实现"></a>FORTRAN 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">C Print all the Narcissistic numberC between 100 and 999</span><br><span class="line">WRITE(*,30)</span><br><span class="line">DO 10</span><br><span class="line">K=100,999</span><br><span class="line">IA=K/100</span><br><span class="line">IB=MOD(K,100)/10</span><br><span class="line">IC=MOD(K,10)</span><br><span class="line">IF(K.NE.IA**3+IB**3+IC**3) GOTO 10</span><br><span class="line">WRITE(*,20)</span><br><span class="line">K, IA,IB,IC10</span><br><span class="line">CONTINUE20</span><br><span class="line">FORMAT(5X,4I4)30</span><br><span class="line">FORMAT(5X,18HN=I**3+J**3+K**3)</span><br><span class="line">STOP　END</span><br><span class="line">Erlang实现</span><br><span class="line">1</span><br><span class="line">[X*100+Y*10+Z||X&lt;-lists:<span class="built_in">seq</span>(1,9),Y&lt;-lists:<span class="built_in">seq</span>(0,9),Z&lt;-lists:<span class="built_in">seq</span>(0,9),X*X*X+Y*Y*Y+Z*Z*Z=:=X*100+Y*10+Z].</span><br><span class="line">Kotlin 实现</span><br></pre></td></tr></table></figure>


<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">fun main(args: Array&lt;String&gt;) &#123;</span><br><span class="line">    val n = 5</span><br><span class="line">    println(factorial1(n))</span><br><span class="line">    println(factorial2(n))</span><br><span class="line">    (100..999).filter &#123;</span><br><span class="line">        val r = it / 100</span><br><span class="line">        val s = (it - r * 100) / 10</span><br><span class="line">        val t = it - r * 100 - s * 10</span><br><span class="line">        it == r * r * r + s * s * s + t * t * t</span><br><span class="line">    &#125;.forEach&#123; println(it)&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>


<h3 id="Visual-Fox-Pro-实现"><a href="#Visual-Fox-Pro-实现" class="headerlink" title="Visual Fox Pro 实现"></a>Visual Fox Pro 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">sumnum = 0</span><br><span class="line">FOR a = 3 TO 7</span><br><span class="line">?ALLTRIM(STR(a))+<span class="string">&quot;位的水仙花数有: &quot;</span></span><br><span class="line">    FOR i=10^(a-1) TO 10^a-1</span><br><span class="line">        FOR m = 1 TO a</span><br><span class="line">            n = SUBSTR(ALLTRIM(STR(i)),m,1)</span><br><span class="line">            sumnum = sumnum+VAL(n)^a</span><br><span class="line">        ENDFOR</span><br><span class="line">        IF i = sumnum</span><br><span class="line">            ??STR(i,a,0)+<span class="string">&quot;    &quot;</span></span><br><span class="line">        ENDIF</span><br><span class="line">        sumnum = 0</span><br><span class="line">    ENDFOR</span><br><span class="line">ENDFOR</span><br></pre></td></tr></table></figure>


<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br></pre></td><td class="code"><pre><span class="line">Visual FoxPro 用表单实现法（只计3位）</span><br><span class="line">方法一：</span><br><span class="line">clear</span><br><span class="line"><span class="keyword">for</span> a=1 to 9</span><br><span class="line">    <span class="keyword">for</span> b=0 to 9</span><br><span class="line">        <span class="keyword">for</span> c=0 to 9</span><br><span class="line">           x=a*100+b*10+c</span><br><span class="line">           <span class="keyword">if</span> x=a^3+b^3+c^3</span><br><span class="line">                            ?x</span><br><span class="line">            endif</span><br><span class="line">        endfor</span><br><span class="line">    endfor</span><br><span class="line">endfor</span><br><span class="line">方法二：</span><br><span class="line">（1）创建表单Form1并添加文本框Text1与命令按钮Command1</span><br><span class="line">（2）修改Command1的Caption属性为“计算并显示”</span><br><span class="line">（3）为Form1添加方法sxh</span><br><span class="line">（4）修改方法sxh代码如下</span><br><span class="line">para x</span><br><span class="line">x1=int(x%10)</span><br><span class="line">x2=int(x/10)%10</span><br><span class="line">x3=int(x/100)%100</span><br><span class="line"><span class="keyword">if</span> x=x1^3+x2^3+x3^3</span><br><span class="line"><span class="built_in">return</span> .t.</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line"><span class="built_in">return</span> .f.</span><br><span class="line">endif</span><br><span class="line">（5）为Command1的Click事件编写如下的事件代码：</span><br><span class="line">thisform.currentx=thisform.width/2</span><br><span class="line">thisform.currenty=thisform.height/2</span><br><span class="line">thisform.print(<span class="string">&quot;水仙花数是：&quot;</span>)</span><br><span class="line"><span class="keyword">for</span> m=100 to 999</span><br><span class="line">thisform.text1.value=m</span><br><span class="line">sure=thisform.sxh(m)</span><br><span class="line"><span class="keyword">if</span> sure=.t.</span><br><span class="line">thisform.print(str(m,4)+space(3))</span><br><span class="line">inkey(0.5)</span><br><span class="line">endif</span><br><span class="line"><span class="keyword">for</span> 延迟=1 to 20000</span><br><span class="line">yiru=2008610029</span><br><span class="line">endfor</span><br><span class="line">endfor</span><br><span class="line">this.enabled=.f.</span><br></pre></td></tr></table></figure>


<h3 id="F-实现"><a href="#F-实现" class="headerlink" title="F# 实现"></a>F# 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">let</span> power3 x= x*x*x</span><br><span class="line"><span class="built_in">let</span> findNarcissisticNumber ()=</span><br><span class="line"><span class="built_in">seq</span> &#123;100..999&#125;</span><br><span class="line">|&gt; Seq.<span class="built_in">where</span> (fun num-&gt;</span><br><span class="line"><span class="built_in">let</span> x= num/100 //百位</span><br><span class="line"><span class="built_in">let</span> y= num%100/10 //十位</span><br><span class="line"><span class="built_in">let</span> z= num%10 //个位</span><br><span class="line">power3 x + power3 y + power3 z = num)</span><br><span class="line"><span class="built_in">let</span> narcissisticNumbers= findNarcissisticNumber()</span><br><span class="line">printfn <span class="string">&quot;Narcissistic Numbers :%A&quot;</span> narcissisticNumbers</span><br><span class="line"></span><br></pre></td></tr></table></figure>


<h3 id="ActionScript-实现"><a href="#ActionScript-实现" class="headerlink" title="ActionScript 实现"></a>ActionScript 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">var n:int;</span><br><span class="line">var m:int;</span><br><span class="line"><span class="keyword">for</span> (var i:int=1; i&lt;=9; i++) &#123;</span><br><span class="line"> <span class="keyword">for</span> (var j:int=1; i&lt;=9; j++) &#123;</span><br><span class="line">  <span class="keyword">for</span> (var k:int=1; i&lt;=9; k++) &#123;</span><br><span class="line">   m=i*100+j*10+k;</span><br><span class="line">    <span class="keyword">if</span> (m==i*i*i+j*j*j+k*k*k)</span><br><span class="line">     &#123; n++; trace(m); &#125;</span><br><span class="line">   &#125;</span><br><span class="line"> &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>


<h3 id="x86-16位汇编语言实现"><a href="#x86-16位汇编语言实现" class="headerlink" title="x86 16位汇编语言实现"></a>x86 16位汇编语言实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br></pre></td><td class="code"><pre><span class="line">stack segment stack</span><br><span class="line">    dw 256 dup (?)</span><br><span class="line">stack ends</span><br><span class="line"> </span><br><span class="line">data segment</span><br><span class="line">    buf db 3 dup (?)</span><br><span class="line">data ends</span><br><span class="line"> </span><br><span class="line">code segment</span><br><span class="line">assume cs:code,ds:data,ss:stack</span><br><span class="line"> </span><br><span class="line">fj proc near ;三位数，百位、十位、个位分开，保存在buf中</span><br><span class="line">    push cx</span><br><span class="line">    push dx</span><br><span class="line">    push si</span><br><span class="line">    mov si,0 ;数组下标</span><br><span class="line">    mov cx,10</span><br><span class="line">    fj1:</span><br><span class="line">    mov dx,0</span><br><span class="line">    div cx</span><br><span class="line">    mov buf[si],dl</span><br><span class="line">    inc si</span><br><span class="line">    or ax,ax</span><br><span class="line">    jnz fj1</span><br><span class="line">    mov ax,si</span><br><span class="line">    pop si</span><br><span class="line">    pop dx</span><br><span class="line">    pop cx</span><br><span class="line">    ret</span><br><span class="line">fj endp</span><br><span class="line"> </span><br><span class="line"><span class="built_in">print</span> proc near ;打印三位数</span><br><span class="line">    push cx</span><br><span class="line">    push dx</span><br><span class="line">    mov dx,-1</span><br><span class="line">    push dx</span><br><span class="line">    mov cx,10</span><br><span class="line">    p1:</span><br><span class="line">    mov dx,0</span><br><span class="line">    div cx</span><br><span class="line">    push dx</span><br><span class="line">    or ax,ax</span><br><span class="line">    jnz p1</span><br><span class="line">    p2:</span><br><span class="line">    pop dx</span><br><span class="line">    cmp dx,-1</span><br><span class="line">    je p9</span><br><span class="line">    add dl,30h</span><br><span class="line">    mov ah,2</span><br><span class="line">    int 21h</span><br><span class="line">    jmp p2</span><br><span class="line">    p9:</span><br><span class="line">    mov dl,9 ;输出制表符Tab</span><br><span class="line">    mov ah,2</span><br><span class="line">    int 21h</span><br><span class="line">    pop dx</span><br><span class="line">    pop cx</span><br><span class="line">    ret</span><br><span class="line"><span class="built_in">print</span> endp</span><br><span class="line"> </span><br><span class="line">start:</span><br><span class="line">    mov ax,data</span><br><span class="line">    mov ds,ax</span><br><span class="line">    mov bx,100</span><br><span class="line">    s0:</span><br><span class="line">    mov ax,bx</span><br><span class="line">    call fj</span><br><span class="line">    mov cx,ax</span><br><span class="line">    mov si,0 ;数组下标</span><br><span class="line">    mov dx,0</span><br><span class="line">    s1:</span><br><span class="line">    mov al,buf[si] ;以下三行，求立方</span><br><span class="line">    mul buf[si]</span><br><span class="line">    mul buf[si]</span><br><span class="line">    add dx,ax</span><br><span class="line">    inc si</span><br><span class="line">    loop s1</span><br><span class="line">    cmp dx,bx</span><br><span class="line">    jne s2</span><br><span class="line">    mov ax,dx</span><br><span class="line">    call <span class="built_in">print</span></span><br><span class="line">    s2:</span><br><span class="line">    inc bx</span><br><span class="line">    cmp bx,1000</span><br><span class="line">    jb s0</span><br><span class="line">    mov ah,4ch</span><br><span class="line">    int 21h</span><br><span class="line">code ends</span><br><span class="line">end start</span><br><span class="line"></span><br></pre></td></tr></table></figure>



<h3 id="Lua实现"><a href="#Lua实现" class="headerlink" title="Lua实现"></a>Lua实现</h3><p>输出10000以内·水仙花数</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">function</span> IsNarcLNum(num)</span><br><span class="line">   </span><br><span class="line">  <span class="built_in">local</span> lenth = string.len(tostring(num))</span><br><span class="line">  <span class="built_in">local</span> sumval = 0</span><br><span class="line">   </span><br><span class="line">  num = math.modf(num)</span><br><span class="line">  <span class="built_in">local</span> data = num</span><br><span class="line">  <span class="keyword">while</span>(data &gt; 0 ) <span class="keyword">do</span></span><br><span class="line">    sumval = sumval + (math.fmod(data, 10)^lenth)</span><br><span class="line">    data = math.modf(data/10)</span><br><span class="line">  end</span><br><span class="line">  <span class="keyword">if</span> sumval == num <span class="keyword">then</span></span><br><span class="line">    <span class="built_in">return</span> <span class="literal">true</span></span><br><span class="line">  <span class="keyword">else</span></span><br><span class="line">    <span class="built_in">return</span> <span class="literal">false</span></span><br><span class="line">  end </span><br><span class="line">end</span><br><span class="line"> </span><br><span class="line">val = 10000</span><br><span class="line"><span class="keyword">for</span> i = 1, val <span class="keyword">do</span></span><br><span class="line">  <span class="keyword">if</span> IsNarcLNum(i) <span class="keyword">then</span></span><br><span class="line">    <span class="built_in">print</span>(string.format(<span class="string">&quot;%d&quot;</span>, i))</span><br><span class="line">  end</span><br><span class="line">   </span><br><span class="line">end</span><br></pre></td></tr></table></figure>



<h3 id="Delphi-实现"><a href="#Delphi-实现" class="headerlink" title="Delphi 实现"></a>Delphi 实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">var a,b,c,d:<span class="built_in">integer</span>;</span><br><span class="line">begin <span class="keyword">for</span> a:=100 to 999  <span class="keyword">do</span></span><br><span class="line"> begin</span><br><span class="line"> b := a div 100;</span><br><span class="line"> c := a div 10 mod 10;</span><br><span class="line"> d := a mod 10;</span><br><span class="line"> <span class="keyword">if</span> b*b*b+c*c*c+d*d*d=a <span class="keyword">then</span></span><br><span class="line"> memo1.Lines.Add(inttostr(a))</span><br><span class="line"> end</span><br><span class="line">end;</span><br></pre></td></tr></table></figure>

<h3 id="Julia实现"><a href="#Julia实现" class="headerlink" title="Julia实现"></a>Julia实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">n = 0</span><br><span class="line"><span class="keyword">for</span> i = 100:999</span><br><span class="line">    x1 = Int(floor(i/100))</span><br><span class="line">    x2 = Int(floor(i%100/10))</span><br><span class="line">    x3 = i%10</span><br><span class="line">    <span class="keyword">if</span> i == x1^3 + x2^3 + x3^3</span><br><span class="line">        <span class="built_in">print</span>(i)</span><br><span class="line">        global n = n + 1 </span><br><span class="line">    end</span><br><span class="line">end</span><br><span class="line"></span><br></pre></td></tr></table></figure>


<h3 id="Shell-Script实现"><a href="#Shell-Script实现" class="headerlink" title="Shell Script实现"></a>Shell Script实现</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#!/bin/bash</span></span><br><span class="line"><span class="built_in">echo</span> -n <span class="string">&quot;请输入数字&quot;</span></span><br><span class="line"><span class="built_in">read</span> num</span><br><span class="line"><span class="built_in">sum</span>=0</span><br><span class="line">len=<span class="variable">$&#123;#num&#125;</span></span><br><span class="line"><span class="keyword">for</span> loop <span class="keyword">in</span> `<span class="built_in">seq</span> 0 $[<span class="variable">$len</span>-1]`</span><br><span class="line"><span class="keyword">do</span></span><br><span class="line">        cor=<span class="string">&quot;<span class="variable">$&#123;num:$loop:1&#125;</span>&quot;</span></span><br><span class="line">        <span class="keyword">if</span> grep <span class="string">&#x27;^[[:digit:]]*$&#x27;</span> &lt;&lt;&lt; <span class="string">&quot;<span class="variable">$cor</span>&quot;</span> &gt; /dev/null; <span class="keyword">then</span></span><br><span class="line">                <span class="built_in">sum</span>=$[<span class="variable">$sum</span>+<span class="variable">$cor</span>**<span class="variable">$len</span>]</span><br><span class="line">        <span class="keyword">fi</span></span><br><span class="line"><span class="keyword">done</span></span><br><span class="line"><span class="keyword">if</span> [ <span class="string">&quot;<span class="variable">$sum</span>&quot;</span> == <span class="string">&quot;<span class="variable">$num</span>&quot;</span> ];<span class="keyword">then</span></span><br><span class="line">        <span class="built_in">echo</span> <span class="string">&quot;是水仙花数&quot;</span></span><br><span class="line"><span class="keyword">else</span></span><br><span class="line">        <span class="built_in">echo</span> <span class="string">&quot;不是水仙花数&quot;</span></span><br><span class="line"><span class="keyword">fi</span></span><br></pre></td></tr></table></figure></article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="http://example.com">John Doe</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://example.com/2022/05/27/ss/%E6%B0%B4%E4%BB%99%E8%8A%B1%E6%95%B0/">http://example.com/2022/05/27/ss/%E6%B0%B4%E4%BB%99%E8%8A%B1%E6%95%B0/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://example.com" target="_blank">GS0401</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"></div><div class="post_share"><div class="social-share" data-image="" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/gh/overtrue/share.js@master/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2022/05/27/ss/promise/"><img class="prev-cover" src="" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">promise的含义</div></div></a></div><div class="next-post pull-right"><a href="/2022/05/26/teach/%E4%BD%A0%E5%A5%BD/"><img class="next-cover" src="" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">post</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">John Doe</div><div class="author-info__description"></div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">27</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/xxxxxx"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%B0%B4%E4%BB%99%E8%8A%B1%E6%95%B0"><span class="toc-number">1.</span> <span class="toc-text">水仙花数</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%9A%E4%B9%89"><span class="toc-number">1.1.</span> <span class="toc-text">定义</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%B8%B8%E8%A7%81%E6%B0%B4%E4%BB%99%E8%8A%B1%E6%95%B0"><span class="toc-number">1.2.</span> <span class="toc-text">常见水仙花数</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B1%82%E5%8F%96%E6%96%B9%E6%B3%95"><span class="toc-number">1.3.</span> <span class="toc-text">求取方法</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#C-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.1.</span> <span class="toc-text">C 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#C-%E5%AE%9E%E7%8E%B0-1"><span class="toc-number">1.3.2.</span> <span class="toc-text">C++ 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Java-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.3.</span> <span class="toc-text">Java 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Python-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.4.</span> <span class="toc-text">Python 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#JavaScript-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.5.</span> <span class="toc-text">JavaScript 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#PHP-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.6.</span> <span class="toc-text">PHP 实现</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#PHP%E6%B0%B4%E4%BB%99%E8%8A%B1%E6%95%B0%E5%AE%9E%E7%8E%B0%E4%BB%A3%E7%A0%81"><span class="toc-number">1.3.6.1.</span> <span class="toc-text">PHP水仙花数实现代码</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#PHP%E6%89%80%E6%9C%89%E4%BD%8D%E6%95%B0%E7%90%86%E8%AE%BA%E8%BE%93%E5%87%BA"><span class="toc-number">1.3.6.2.</span> <span class="toc-text">PHP所有位数理论输出</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MATLAB-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.7.</span> <span class="toc-text">MATLAB 实现</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%96%B9%E6%B3%95%E4%B8%80%EF%BC%9A"><span class="toc-number">1.3.7.1.</span> <span class="toc-text">方法一：</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%96%B9%E6%B3%95%E4%BA%8C%EF%BC%9A"><span class="toc-number">1.3.7.2.</span> <span class="toc-text">方法二：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#swift-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.8.</span> <span class="toc-text">swift 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Golang-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.9.</span> <span class="toc-text">Golang 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#C-%E5%AE%9E%E7%8E%B0-2"><span class="toc-number">1.3.10.</span> <span class="toc-text">C# 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#ALGOL-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.11.</span> <span class="toc-text">ALGOL 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#pascal-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.12.</span> <span class="toc-text">pascal 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#BASIC-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.13.</span> <span class="toc-text">BASIC 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Visual-Basic-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.14.</span> <span class="toc-text">Visual Basic 实现</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#Visual-Basic-%E7%9A%84%E2%80%9C%E6%B0%B4%E4%BB%99%E8%8A%B1%E6%95%B0%E2%80%9D%E5%AE%9E%E7%8E%B0%E4%BB%A3%E7%A0%81"><span class="toc-number">1.3.14.1.</span> <span class="toc-text">Visual Basic 的“水仙花数”实现代码</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Visual-Basic-%E7%AE%80%E5%8D%95%E6%98%93%E6%87%82%E4%BB%A3%E7%A0%81%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.14.2.</span> <span class="toc-text">Visual Basic 简单易懂代码实现</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#asp-%E4%B8%ADVB%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.15.</span> <span class="toc-text">asp 中VB实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#FORTRAN-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.16.</span> <span class="toc-text">FORTRAN 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Visual-Fox-Pro-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.17.</span> <span class="toc-text">Visual Fox Pro 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#F-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.18.</span> <span class="toc-text">F# 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#ActionScript-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.19.</span> <span class="toc-text">ActionScript 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#x86-16%E4%BD%8D%E6%B1%87%E7%BC%96%E8%AF%AD%E8%A8%80%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.20.</span> <span class="toc-text">x86 16位汇编语言实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Lua%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.21.</span> <span class="toc-text">Lua实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Delphi-%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.22.</span> <span class="toc-text">Delphi 实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Julia%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.23.</span> <span class="toc-text">Julia实现</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Shell-Script%E5%AE%9E%E7%8E%B0"><span class="toc-number">1.3.24.</span> <span class="toc-text">Shell Script实现</span></a></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2022/06/21/nginx%E7%9A%84%E5%9F%BA%E7%A1%80%E5%85%A5%E9%97%A8/" title="nginx的基础入门"><img src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="nginx的基础入门"/></a><div class="content"><a class="title" href="/2022/06/21/nginx%E7%9A%84%E5%9F%BA%E7%A1%80%E5%85%A5%E9%97%A8/" title="nginx的基础入门">nginx的基础入门</a><time datetime="2022-06-20T23:49:26.000Z" title="发表于 2022-06-21 07:49:26">2022-06-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/06/21/vue3/" title="vue3"><img src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="vue3"/></a><div class="content"><a class="title" href="/2022/06/21/vue3/" title="vue3">vue3</a><time datetime="2022-06-20T23:48:21.000Z" title="发表于 2022-06-21 07:48:21">2022-06-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/06/21/%E4%BD%BF%E7%94%A8%E5%88%86%E6%94%AF%E5%BC%80%E5%8F%91%E5%8A%9F%E8%83%BD%EF%BC%8C%E5%90%88%E5%B9%B6/" title="使用分支开发功能，合并"><img src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="使用分支开发功能，合并"/></a><div class="content"><a class="title" href="/2022/06/21/%E4%BD%BF%E7%94%A8%E5%88%86%E6%94%AF%E5%BC%80%E5%8F%91%E5%8A%9F%E8%83%BD%EF%BC%8C%E5%90%88%E5%B9%B6/" title="使用分支开发功能，合并">使用分支开发功能，合并</a><time datetime="2022-06-20T23:47:54.000Z" title="发表于 2022-06-21 07:47:54">2022-06-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/06/21/git%E7%9A%84%E9%AB%98%E7%BA%A7%E6%93%8D%E4%BD%9C/" title="git的高级操作"><img src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="git的高级操作"/></a><div class="content"><a class="title" href="/2022/06/21/git%E7%9A%84%E9%AB%98%E7%BA%A7%E6%93%8D%E4%BD%9C/" title="git的高级操作">git的高级操作</a><time datetime="2022-06-20T23:46:37.000Z" title="发表于 2022-06-21 07:46:37">2022-06-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/06/20/p10%E6%80%BB%E7%BB%93/" title="p10总结"><img src="" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="p10总结"/></a><div class="content"><a class="title" href="/2022/06/20/p10%E6%80%BB%E7%BB%93/" title="p10总结">p10总结</a><time datetime="2022-06-20T08:54:35.000Z" title="发表于 2022-06-20 16:54:35">2022-06-20</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2022 By John Doe</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js"></script><div class="js-pjax"></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>